var DamageAndOverflowOrder = {
    id: "damageAndOverflowOrderIndexTable",
    damageTable: null,
    overflowTable:null
}

/**
 * 初始化报溢表格的列
 */
DamageAndOverflowOrder.initDamageColumn = function () {
    return [
        {title: '商品id', field: 'id', visible: false, align: 'center', valign: 'middle'},
        {title: '商品编码', field: 'goodsCode', visible: true, align: 'center', valign: 'middle'},
        {title: '商品名称', field: 'goodsName', visible: true, align: 'center', valign: 'middle'},
        {title: '商品型号', field: 'goodsModel', visible: true, align: 'center', valign: 'middle'},
        {title: '商品单位', field: 'goodsUnit', visible: true, align: 'center', valign: 'middle'},
        {
            title: '数量',
            field: 'damageNumber',
            visible: true,
            align: 'center',
            valign: 'middle'
        },
        {title: '商品价格', field: 'damagePrice', visible: true, align: 'center', valign: 'middle'},
        {title: '单据总价', field: 'totalPrice', visible: true, align: 'center', valign: 'middle'},
        {title: '库存数量', field: 'goodsInventoryQuantity', visible: false, align: 'center', valign: 'middle'},
        {title: '库存下限', field: 'goodsMinNum', visible: false, align: 'center', valign: 'middle'},
        {title: '采购价格', field: 'goodsLastPurchasePrice', visible: false, align: 'center', valign: 'middle'},
        {title: '创建者', field: 'createBy', visible: false, align: 'center', valign: 'middle'},
        {title: '创建时间', field: 'createDate', visible: false, align: 'center', valign: 'middle'},
        {title: '更新者', field: 'updateBy', visible: false, align: 'center', valign: 'middle'},
        {title: '更新时间', field: 'updateDate', visible: false, align: 'center', valign: 'middle'},
        {title: '备注信息', field: 'remarks', visible: false, align: 'center', valign: 'middle'},
        {title: '删除标记（0：正常；1：删除）', field: 'delFlag', visible: false, align: 'center', valign: 'middle'},
        {title: '供应商名称', field: 'supplierId', visible: false, align: 'center', valign: 'middle'},
        {title: '商品分类id', field: 'goodsCategoryId', visible: false, align: 'center', valign: 'middle'}
    ];
};


/**
 * 初始化报损表格的列
 */
DamageAndOverflowOrder.initOverflowColumn = function () {
    return [
        {title: '商品id', field: 'id', visible: false, align: 'center', valign: 'middle'},
        {title: '商品编码', field: 'goodsCode', visible: true, align: 'center', valign: 'middle'},
        {title: '商品名称', field: 'goodsName', visible: true, align: 'center', valign: 'middle'},
        {title: '商品型号', field: 'goodsModel', visible: true, align: 'center', valign: 'middle'},
        {title: '商品单位', field: 'goodsUnit', visible: true, align: 'center', valign: 'middle'},
        {
            title: '数量',
            field: 'goodsNumber',
            visible: true,
            align: 'center',
            valign: 'middle'
        },
        {title: '商品价格', field: 'goodsPrice', visible: true, align: 'center', valign: 'middle'},
        {title: '单据总价', field: 'totalPrice', visible: true, align: 'center', valign: 'middle'},
        {title: '库存数量', field: 'goodsInventoryQuantity', visible: false, align: 'center', valign: 'middle'},
        {title: '库存下限', field: 'goodsMinNum', visible: false, align: 'center', valign: 'middle'},
        {title: '采购价格', field: 'goodsLastPurchasePrice', visible: false, align: 'center', valign: 'middle'},
        {title: '创建者', field: 'createBy', visible: false, align: 'center', valign: 'middle'},
        {title: '创建时间', field: 'createDate', visible: false, align: 'center', valign: 'middle'},
        {title: '更新者', field: 'updateBy', visible: false, align: 'center', valign: 'middle'},
        {title: '更新时间', field: 'updateDate', visible: false, align: 'center', valign: 'middle'},
        {title: '备注信息', field: 'remarks', visible: false, align: 'center', valign: 'middle'},
        {title: '删除标记（0：正常；1：删除）', field: 'delFlag', visible: false, align: 'center', valign: 'middle'},
        {title: '供应商名称', field: 'supplierId', visible: false, align: 'center', valign: 'middle'},
        {title: '商品分类id', field: 'goodsCategoryId', visible: false, align: 'center', valign: 'middle'}
    ];
};


$(function () {
    var damageColumn = DamageAndOverflowOrder.initDamageColumn();
    var overflowColumn = DamageAndOverflowOrder.initOverflowColumn();

    var queryType = $("#queryType").val();
    console.log('queryType=',queryType);
    console.log(typeof queryType);
    if(1 === parseInt(queryType)){
        var table = new BSTable(DamageAndOverflowOrder.id, "/managerGoods/goodsDamageAndOverflowOrder/detail/" + $("#orderId").val() + "/" + queryType, damageColumn);
        table.setTableHeight(0);
        table.setShowColumns(false);
        table.setShowRefresh(false);
        DamageAndOverflowOrder.damageTable = table.init();
    }

    if(2 === parseInt(queryType)){
        var table = new BSTable(DamageAndOverflowOrder.id, "/managerGoods/goodsDamageAndOverflowOrder/detail/" + $("#orderId").val() + "/" + queryType, overflowColumn);
        table.setTableHeight(0);
        table.setShowColumns(false);
        table.setShowRefresh(false);
        DamageAndOverflowOrder.overflowTable = table.init();
    }

})